#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
const int MAXN=5e4+10;
LL n,tot,a[MAXN],b[MAXN],q[MAXN],f[MAXN];
struct node
{
	LL a,b;
}data[MAXN];
bool cmp(node a,node b)
{
	return a.a==b.a?a.b>b.b:a.a<b.a;
}
db slope(LL x,LL y)
{
	return (f[y]-f[x])*1.0/(b[x+1]-b[y+1]);
}
int main()
{
	scanf("%lld",&n);
	for(LL i=1;i<=n;++i)
		scanf("%lld%lld",&data[i].a,&data[i].b);
	sort(data+1,data+1+n,cmp);
	for(LL i=1;i<=n;++i)
	{
		while(data[i].b>=b[tot]&&tot)--tot;
		a[++tot]=data[i].a;b[tot]=data[i].b;
	}
	LL l=0,r=0;
	for(LL i=1;i<=tot;++i)
	{
		while(l<r&&slope(q[l],q[l+1])<a[i])++l;
		LL t=q[l];
		f[i]=f[t]+a[i]*b[t+1];
		while(l<r&&slope(q[r-1],q[r])>=slope(q[r],i))--r;
		q[++r]=i;
	}
	printf("%lld\n",f[tot]);
	return 0;
}
